<?php

class Role extends Base_Model 
{

    function __Construct()
    {
        parent::__Construct();
        $this->init("role","id_role","nama_role");
    }
	
    function is_exists($nama_role)
    {
		$this->db->select("nama_role")
				 ->from("role")
			 ->where("nama_role","$nama_role");
		$rec = $this->db->get();
		if($rec->num_rows()>0)
		{
				return TRUE;
		}
		return FALSE;
    }
	
	function all_dept($id_role)
	{
		$sql="select count(*) as 'j' from role_dept where id_role=$id_role";
		$rec = $this->db->query($sql);
		if($rec->num_rows()>0)
		{
			$row = $rec->row();
			return $row->j;
		}
		else
		{
			return FALSE;
		}
	}
}

/* End of file role.php */
?>